package com.exthirteen.textgamescript.config;


import com.exthirteen.textgamescript.model.vo.ResultStatus;

public class BaseException extends RuntimeException {

    /**
     * 错误码
     */
    private String code;

    public BaseException() {
        super();
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }

    public BaseException(String code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(Throwable cause) {
        super(cause);
    }


    public static BaseException get(String code, String message) {
        return new BaseException(code, message);
    }

    public static BaseException get(ResultStatus resultStatus) {
        return new BaseException(resultStatus.getCode(), resultStatus.getMsg());
    }

    public String getCode() {
        return code;
    }
}
